package com.bsoft.gol.hcs.specialist.service;

import ctd.controller.exception.ControllerException;
import ctd.util.annotation.RpcService;
import com.bsoft.gol.hcs.specialist.bean.response.HealthEducationList;
import com.bsoft.gol.hcs.specialist.entity.FusHealthEducationEntity;
import com.bsoft.gol.hcs.specialist.entity.FusHealthEducationRelation;

import java.util.List;

/**
 * 随访系统_健康宣教库_数据访问层接口
 *
 * @author tongtp
 * @version v0.1
 * @create 2018-11-11 14:11
 **/
public interface IFusHealthEducationService {

    /**
     * 根据id和type查询到健康宣教材料对应列表
     *
     * @param id   健康宣教id
     * @param type 健康宣教类型
     * @return 健康宣教材料对应列表
     */
    @RpcService
    List<FusHealthEducationEntity> findFusHealthEducationListByIdAndType(Long id, Integer type) throws ControllerException;

    /**
     * 根据宣教id查询到健康宣教材料详情
     *
     * @param id 健康宣教id
     * @return
     */
    @RpcService
    List<FusHealthEducationEntity> findFusHealthEducationSubListByIdAndType(Long id) throws ControllerException;

    /**
     * 通过id查询健康宣教列表
     *
     * @param educationIdList
     * @return 宣教列表
     */
    @RpcService
    List<FusHealthEducationEntity> findFusHealthEducationSubListByIdList(List<Long> educationIdList) throws ControllerException;

    /**
     * 根据科室id查询到健康宣教列表
     *
     * @param departmentId 科室id
     * @return
     */
    @RpcService
    List<FusHealthEducationEntity> findFusHealthEducationSubListByDepartmentId(String departmentId);

    /**
     * 根据机构id查询健康宣教列表
     * @param orgId
     * @return
     */
    List<FusHealthEducationEntity> findFusHealthEducationSubListByOrgId(String orgId);

    /**
     * 根据机构id和departmentId查询健康宣教列表
     * @param orgId
     * @return
     */
    List<FusHealthEducationEntity> findListByOrgIdAndDepartmentId(String orgId, String departmentId);

    /**
     * 查询到健康宣教库的顶级目录层级
     *
     * @return 目录层级
     */
    @RpcService
    List<FusHealthEducationEntity> findFusHealthEducationTopCatalog();

    /**
     * 查询到健康宣教库目录下的子目录或内容
     *
     * @param fusHealthEducationId 健康宣教id
     * @return 健康宣教信息
     */
    @RpcService
    List<FusHealthEducationEntity> findLowerFusHealthEducationList(Long fusHealthEducationId) throws ControllerException;

    /**
     * 新增健康宣教
     *
     * @param fusHealthEducation 健康宣教入参
     */
    @RpcService
    FusHealthEducationEntity insertFusHealthEducation(FusHealthEducationEntity fusHealthEducation);

    @RpcService
    void insertFusHealthEducationRelation(FusHealthEducationRelation fusHealthEducationRelation);

    /**
     * 根据ID更新健康宣教库数据
     *
     * @paramfusHealthEducation
     */
    @RpcService
    void updateFusHealthEducationById(FusHealthEducationEntity fusHealthEducation);

    /**
     * 根据ID删除健康宣教库数据
     *
     * @param fusHealthEducationId 健康宣教id
     */
    @RpcService
    void deleteFusHealthEducationById(Long fusHealthEducationId) throws ControllerException;

    @RpcService
    void deleteHealthEducationRelationByFusHealthEducationId(Long fusHealthEducationId) throws ControllerException;

    /**
     * 获取健康宣教材料详情
     *
     * @param fusHealthEducationId 健康宣教Id
     * @return 健康宣教内容
     */
    @RpcService
    FusHealthEducationEntity getFusHealthEducationContent(Long fusHealthEducationId) throws ControllerException;

    /**
     * 目录上移
     *
     * @param fusHealthEducationId 健康宣教Id
     * @param sort                 当前排序
     * @param parentId             父级id
     */
    @RpcService
    void upCatalog(Long fusHealthEducationId, Integer sort, Long parentId) throws ControllerException;

    /**
     * 目录下移
     *
     * @param fusHealthEducationId 健康宣教Id
     * @param sort                 当前排序
     * @param parentId             父级id
     */
    @RpcService
    void downCatalog(Long fusHealthEducationId, Integer sort, Long parentId) throws ControllerException;

    /**
     * 把当前排序后面的目录排序都减一
     *
     * @param parentId 父级id
     * @param sort     当前排序
     */
    @RpcService
    void updateCatalogSort(Long parentId, Integer sort) throws ControllerException;

    /**
     * 根据目录名称/内容标题查询健康宣教
     *
     * @param name 父级id
     * @return 健康宣教
     */
    @RpcService
    FusHealthEducationEntity getFusHealthEducationByName(String name) throws ControllerException;


    /**
     * 通过健康宣教id查询病种列表
     *
     * @param fusHealthEducationId 健康宣教id
     * @return 病种列表
     */
    @RpcService
    List<FusHealthEducationRelation> findFusHealthEducationRelations(Long fusHealthEducationId) throws ControllerException;

    /**
     * 通过病种id查询健康宣教列表
     *
     * @param diseaseTypeId 病种id
     * @return 宣教列表
     */
    @RpcService
    List<HealthEducationList> findDiseaseTypeListByDiseeId(Long diseaseTypeId) throws ControllerException;

    /**
     * 通过病种id查询健康宣教列表
     *
     * @param diseaseTypeIdList 病种id集合
     * @return 宣教列表
     */
    @RpcService
    List<HealthEducationList> findDiseaseTypeListByDiseeIdarr(List<Long> diseaseTypeIdList) throws ControllerException;

    FusHealthEducationEntity getFusHealthEducationById(Long fusHealthEducationId) throws ControllerException;
}
